<?php

namespace app\adminapi\export;

use app\services\product\product\StoreProductLabelServices;

class StoreProductLabelExport extends BaseExport
{
    protected $header = [
        '标签ID', '标签名称', '排序', '在首页展示'
    ];

    public function createData(array $where)
    {
        $list = app()->make(StoreProductLabelServices::class)->getList($where)['list'];
        $data = [];
        foreach ($list as $item) {
            $data[] = [
                $item->id,
                $item->label_name,
                $item->sort_order,
                $item->is_displayed_on_home ? '是' : '否'
            ];
        }

        return $data;
    }
}